package cn.zxinrun.wps.example;

import cn.zxinrun.wps.util.ExcelUtils;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * 复杂表头使用示例
 * 演示如何使用 ExcelUtils 的复杂表头功能
 * @author Mr.Zhang
 * @since 1.0
 **/
//@Slf4j
public class ComplexHeaderUsageExample {

    public static void main(String[] args) {
        // 创建测试数据
        List<ComplexHeaderExample> dataList = createTestData();
        
        // 创建 ExcelUtils 实例
        ExcelUtils<ComplexHeaderExample> excelUtils = new ExcelUtils<>(ComplexHeaderExample.class);
        
        try {
            // 导出到文件（支持复杂表头）
            excelUtils.exportExcel(
                "/Users/zhang/Develop_Programs/Company_Projects/Yuanjing_SVN/Server/Jt-System/cacheTemp/2.xlsx",
                dataList, 
                "员工信息表", 
                "员工详细信息统计表"
            );
            
//            log.info("复杂表头Excel文件导出成功！");
            
        } catch (Exception e) {
//            log.error("导出Excel文件失败", e);
        }
    }

    /**
     * 创建测试数据
     * @return 测试数据列表
     */
    private static List<ComplexHeaderExample> createTestData() {
        List<ComplexHeaderExample> dataList = new ArrayList<>();
        
        // 员工1
        ComplexHeaderExample employee1 = new ComplexHeaderExample();
        employee1.setName("张三");
        employee1.setAge(28);
        employee1.setGender("男");
        employee1.setPhone("13800138001");
        employee1.setEmail("zhangsan@example.com");
        employee1.setSalary(new java.math.BigDecimal("8000.00"));
        employee1.setBonus(new java.math.BigDecimal("2000.00"));
        employee1.setHireDate(LocalDateTime.of(2020, 3, 15, 9, 0, 0));
        employee1.setUpdateTime(LocalDateTime.now());
        employee1.setRemark("优秀员工");
        dataList.add(employee1);
        
        // 员工2
        ComplexHeaderExample employee2 = new ComplexHeaderExample();
        employee2.setName("李四");
        employee2.setAge(32);
        employee2.setGender("女");
        employee2.setPhone("13800138002");
        employee2.setEmail("lisi@example.com");
        employee2.setSalary(new java.math.BigDecimal("12000.00"));
        employee2.setBonus(new java.math.BigDecimal("3000.00"));
        employee2.setHireDate(LocalDateTime.of(2018, 7, 20, 9, 0, 0));
        employee2.setUpdateTime(LocalDateTime.now());
        employee2.setRemark("技术骨干");
        dataList.add(employee2);
        
        // 员工3
        ComplexHeaderExample employee3 = new ComplexHeaderExample();
        employee3.setName("王五");
        employee3.setAge(25);
        employee3.setGender("男");
        employee3.setPhone("13800138003");
        employee3.setEmail("wangwu@example.com");
        employee3.setSalary(new java.math.BigDecimal("6000.00"));
        employee3.setBonus(new java.math.BigDecimal("1500.00"));
        employee3.setHireDate(LocalDateTime.of(2021, 1, 10, 9, 0, 0));
        employee3.setUpdateTime(LocalDateTime.now());
        employee3.setRemark("新人");
        dataList.add(employee3);
        
        return dataList;
    }
} 